Skip to content

fix: include the store location in ObjectRef.full_path - #1648

Merged
dimitri-yatsenko merged 2 commits into
datajoint:masterfrom
TheeCoderAhmed:fix/objectref-full-path-location
Nov 10, 2026
Merged

dimitri-yatsenko merged 2 commits into
datajoint:masterfrom
TheeCoderAhmed:fix/objectref-full-path-location

Conversation

@TheeCoderAhmed

@TheeCoderAhmed TheeCoderAhmed commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1646.

ObjectRef.full_path left out the store location for s3, gcs and azure. So fs.exists(ref.full_path) returned False for objects that ref.read() could open.

It now uses self._backend.get_url(self.path). Local paths are unchanged.

Tests are in tests/unit/test_objectref.py. No network needed. The location cases fail on master.

Thanks for the review.

For s3, gcs and azure stores, full_path built <protocol>://<bucket>/<path> and left out the store's location, so it pointed to a path where the object is not when location is set. Use StorageBackend.get_url(), which builds the URL from the same _full_path the backend writes to.

Fixes datajoint#1646

@dimitri-yatsenko dimitri-yatsenko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Correct. StorageBackend.get_url goes through _full_path, which is where objects are written, so fs.exists(ref.full_path) now agrees with the backend.
  2. A test with an s3 endpoint plus location, and a trailing-slash location ("proj/outbox/"), would pin the double-slash case if _full_path doesn't normalize it.
  3. The file branch still builds its path by hand. It could also use get_url/_full_path for consistency, as a follow-up.

@dimitri-yatsenko dimitri-yatsenko modified the milestones: v2.3.6, v2.3.7 Nov 6, 2026
…tions

The reviewer asked for a case that pins the trailing-slash location. It asserts that full_path equals what the backend builds for reads and writes, so it holds whether or not _full_path ever normalizes the slash.
@TheeCoderAhmed

Copy link
Copy Markdown
Contributor Author

Added the trailing-slash test in f5ec087. Left the file branch for a follow-up. Thanks.

@dimitri-yatsenko dimitri-yatsenko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TheeCoderAhmed, this is ready.

  • The s3 store with an endpoint and a location is pinned by a literal assertion in test_full_path_includes_store_location, and gcs and azure are covered too.
  • full_path now agrees with where the backend writes objects. With a trailing-slash location, both give .../proj/outbox//.... That is consistent with existing stores, so not normalizing it here is the right call.
  • CI passes on f5ec087: lint, and the MySQL 8.0 and 8.4 and Windows legs on Python 3.10, 3.14 and 3.15.

The remaining cases are in #1679: the file branch, and storage plugins registered through the datajoint.storage entry point, which still get the path without the location.

@dimitri-yatsenko
dimitri-yatsenko merged commit 7fd96de into datajoint:master Nov 10, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ObjectRef.full_path leaves out the store's location for s3, gcs and azure stores

2 participants